<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<style type="text/css">
			#div1 div {
				display:none;
			}
		</style>
		<script type="text/javascript">
			window.onload=function(){
				var oTab=new Tab('div1');}
			
				function Tab(id){
					var oDiv=document.getElementById(id);
					this.aInp=oDiv.getElementsByTagName("input");
					this.aDiv=oDiv.getElementsByTagName("div");
					var i=0
					var _this=this;
					for(var i=0;i<this.aInp.length;i++){
						this.aInp[i].index=i
						this.aInp[i].onclick=function(){
							_this.tab(this)
						}
					}
				}
				Tab.prototype.tab=function(oInp){
					for(var i=0;i<this.aInp.length;i++){
						this.aDiv[i].style.display='none';
					}
					this.aDiv[oInp.index].style.display='block';
				}
				
			

		</script>
		<div id="div1">
			<input type="button" value="按钮1">
			<input type="button" value="按钮2">
			<input type="button" value="按钮3">
			<div style="display:block;">asdwa</div>
			<div>asdasdasdasd</div>
			<div>asdasdwdasd</div>
		</div>
	</body>
</html>
